import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: { title: '登录', icon: '' }
  },
  {
    path: '/',
    name: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    children: [
      {
        path: 'home',
        name: 'Home',
        component: () => import('@/views/home/index.vue'),
        meta: { title: '首页', icon: '' }
      },
      {
        path: 'user',
        name: 'User',
        meta: { title: '用户管理', icon: '' },
        redirect: '/user/list',
        children: [
          {
            path: '/user/list',
            name: 'UserList',
            component: () => import('@/views/user/index.vue'),
            meta: { title: '用户列表', icon: '' }
          },
          {
            path: '/user/list_del',
            name: 'UserListDel',
            component: () => import('@/views/user_del/index.vue'),
            meta: { title: '用户列表(已删)', icon: '' }
          }
        ]
      },
      {
        path: 'system',
        name: 'System',
        meta: { title: '系统管理', icon: '' },
        redirect: '/system/tag',
        children: [
          // {
          //   path: '/system/menu',
          //   name: 'Menu',
          //   component: () => import('@/views/system/menu/index.vue'),
          //   meta: { title: '菜单管理', icon: '' }
          // },
          {
            path: '/system/tag',
            name: 'Tag',
            component: () => import('@/views/system/tag/index.vue'),
            meta: { title: '标签管理', icon: '' }
          },
          {
            path: '/system/sort',
            name: 'Sort',
            component: () => import('@/views/system/sort/index.vue'),
            meta: { title: '分类管理', icon: '' }
          },
          {
            path: '/system/catalog',
            name: 'Catalog',
            component: () => import('@/views/system/catalog/index.vue'),
            meta: { title: '目录管理', icon: '' }
          },
          {
            path: '/system/field',
            name: 'Field',
            component: () => import('@/views/system/field/index.vue'),
            meta: { title: '字段库', icon: '' }
          },
          {
            path: '/system/dictionary',
            name: 'Dictionary',
            component: () => import('@/views/system/dictionary/index.vue'),
            meta: { title: '字典库', icon: '' }
          },
          {
            path: '/system/file',
            name: 'File',
            component: () => import('@/views/system/file/index.vue'),
            meta: { title: '文件库', icon: '' }
          },
          {
            path: '/system/icon',
            name: 'Icon',
            component: () => import('@/views/system/icon/index.vue'),
            meta: { title: '图标库', icon: '' }
          },
          {
            path: '/system/login_log',
            name: 'LoginLog',
            component: () => import('@/views/system/login_log/index.vue'),
            meta: { title: '登录日志', icon: '' }
          },
          {
            path: '/system/operation_log',
            name: 'OperationLog',
            component: () => import('@/views/system/operation_log/index.vue'),
            meta: { title: '操作日志', icon: '' }
          }
        ]
      },
      {
        path: 'blog',
        name: 'Blog',
        meta: { title: '博客导航', icon: '' },
        redirect: '/blog/website',
        children: [
          {
            path: '/blog/website',
            name: 'Website',
            component: () => import('@/views/blog/website/index.vue'),
            meta: { title: '网站导航', icon: '' }
          },
          {
            path: '/blog/note',
            name: 'Note',
            component: () => import('@/views/blog/note/index.vue'),
            meta: { title: '博客笔记', icon: '' }
          },
          {
            path: '/blog/project_code',
            name: 'ProjectCode',
            component: () => import('@/views/blog/project_code/index.vue'),
            meta: { title: '项目源码', icon: '' }
          },
          {
            path: '/blog/code_part',
            name: 'CodePart',
            component: () => import('@/views/blog/code_part/index.vue'),
            meta: { title: '代码片段', icon: '' }
          },
          {
            path: '/blog/software',
            name: 'Software',
            component: () => import('@/views/blog/software/index.vue'),
            meta: { title: '软件推荐', icon: '' }
          },
          {
            path: '/blog/book',
            name: 'Book',
            component: () => import('@/views/blog/book/index.vue'),
            meta: { title: '书籍推荐', icon: '' }
          }
        ]
      },
      {
        path: 'buy',
        name: 'Buy',
        meta: { title: '购物比价', icon: '' },
        redirect: '/buy/goods',
        children: [
          {
            path: '/buy/goods',
            name: 'Goods',
            component: () => import('@/views/buy/goods/index.vue'),
            meta: { title: '商品导购', icon: '' }
          },
          // {
          //   path: '/buy/software',
          //   name: 'Software',
          //   component: () => import('@/views/buy/software/index.vue'),
          //   meta: { title: '购物软件', icon: '' }
          // },
          // {
          //   path: '/buy/website',
          //   name: 'Website',
          //   component: () => import('@/views/buy/website/index.vue'),
          //   meta: { title: '购物网站', icon: '' }
          // },
          {
            path: '/buy/purchased',
            name: 'Purchased',
            component: () => import('@/views/buy/purchased/index.vue'),
            meta: { title: '已购流水', icon: '' }
          },
          {
            path: '/buy/pricing',
            name: 'Pricing',
            component: () => import('@/views/buy/pricing/index.vue'),
            meta: { title: '未购计价', icon: '' }
          }
        ]
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
